package com.aspose.cells;

import java.util.ArrayList;

class zapn {
   private zcfw a;
   private zapy b;
   private static final com.aspose.cells.b.c.a.za c = new com.aspose.cells.b.c.a.za(new String[]{"display", "style-name", "text-style-name", "x", "y", "width", "height", "p", "span"});

   zapn(zapy var1) {
      this.b = var1;
   }

   void a(Shape var1, zcfw var2) throws Exception {
      this.a = var2;
      String var3 = null;
      String var4 = null;
      int var5 = 0;
      int var6 = 0;
      int var7 = 0;
      int var8 = 0;
      if (var2.m()) {
         while(true) {
            if (!var2.l()) {
               var2.k();
               break;
            }

            switch(c.a(var2.p())) {
            case 0:
               ((CommentShape)var1).a().setVisible(com.aspose.cells.b.a.zv.a(var2.s(), "true", true) == 0);
               break;
            case 1:
               var3 = var2.s();
               break;
            case 2:
               var4 = var2.s();
               break;
            case 3:
               var5 = zaqh.a(this.b.a, var2.s());
               break;
            case 4:
               var6 = zaqh.a(this.b.a, var2.s());
               break;
            case 5:
               var7 = zaqh.a(this.b.a, var2.s());
               break;
            case 6:
               var8 = zaqh.a(this.b.a, var2.s());
            }
         }
      }

      var1.a(0, false, var5, var6, var7, var8);
      if (var2.n()) {
         var2.a();
      } else {
         var2.d();
         Font var9 = null;
         if (var4 != null) {
            zaqt var10 = (zaqt)this.b.h.get(var4);
            if (var10 != null && var10.b != null) {
               var9 = var10.b;
            } else {
               var9 = this.b.b.getWorksheets().j(0);
            }
         } else {
            var9 = this.b.b.getWorksheets().j(0);
         }

         var2.a(1);
         ArrayList var12 = new ArrayList();

         while(var2.r() != 4) {
            var2.j();
            if (var2.r() == 4) {
               break;
            }

            if (var2.r() != 1) {
               if (var2.r() == 3) {
                  zaqu var11 = new zaqu();
                  var11.a = var2.s();
                  com.aspose.cells.b.a.a.ze.a(var12, (Object)var11);
               }

               var2.a();
            } else {
               switch(c.a(var2.p().toLowerCase())) {
               case 7:
                  this.a(var12);
                  break;
               case 8:
                  this.a(var12, var9);
                  break;
               default:
                  var2.a();
               }
            }
         }

         var2.h();
         var2.a(0);
         if (var12.size() != 0) {
            switch(var1.getMsoDrawingType()) {
            case 25:
               this.a(var12, ((CommentShape)var1).a().b(), var9);
            }
         }

      }
   }

   void a(ArrayList var1) throws Exception {
      if (this.a.n()) {
         this.a.a();
      } else {
         String var2 = null;
         if (var1.size() != 0) {
            zaqu var3 = (zaqu)var1.get(var1.size() - 1);
            var3.a = var3.a + "\n";
            var1.set(var1.size() - 1, var3);
         }

         if (this.a.m()) {
            while(this.a.l()) {
               switch(c.a(this.a.p())) {
               case 1:
                  var2 = this.a.s();
               }
            }
         }

         Font var5 = null;
         if (var2 != null && !"".equals(var2)) {
            zaqt var4 = (zaqt)this.b.h.get(var2);
            var5 = var4.b;
         }

         this.a.d();

         while(this.a.r() != 4) {
            this.a.j();
            if (this.a.r() == 4) {
               break;
            }

            if (this.a.r() != 1) {
               if (this.a.r() == 3) {
                  zaqu var6 = new zaqu();
                  var6.a = this.a.s();
                  var6.b = var5;
                  com.aspose.cells.b.a.a.ze.a(var1, (Object)var6);
               }

               this.a.a();
            } else {
               switch(c.a(this.a.p().toLowerCase())) {
               case 8:
                  this.a(var1, var5);
                  break;
               default:
                  this.a.a();
               }
            }
         }

         this.a.h();
      }
   }

   void a(ArrayList var1, Font var2) throws Exception {
      if (this.a.n()) {
         this.a.a();
      } else {
         zaqu var3 = new zaqu();
         if (this.a.m()) {
            while(this.a.l()) {
               switch(c.a(this.a.p())) {
               case 1:
                  var3.b = (Font)this.b.g.get(this.a.s());
               }
            }

            this.a.k();
         }

         if (this.a.n()) {
            this.a.a();
         } else {
            this.a.d();

            for(; this.a.r() != 4; this.a.a()) {
               this.a.j();
               if (this.a.r() == 3) {
                  if (var3.a == null) {
                     var3.a = this.a.s();
                  } else {
                     var3.a = var3.a + this.a.s();
                  }
               }
            }

            this.a.h();
            if (var3.a != null) {
               com.aspose.cells.b.a.a.ze.a(var1, (Object)var3);
            }
         }

      }
   }

   private void a(ArrayList var1, zbtz var2, Font var3) {
      if (var1.size() < 0) {
         var2.a(var3);
      } else if (var1.size() == 1) {
         zaqu var9 = (zaqu)var1.get(0);
         var2.a(var9.a);
         var2.a(var9.b == null ? var3 : var9.b);
      } else {
         StringBuilder var4 = new StringBuilder();
         ArrayList var5 = new ArrayList();

         for(int var6 = 0; var6 < var1.size(); ++var6) {
            zaqu var7 = (zaqu)var1.get(var6);
            FontSetting var8 = new FontSetting(var4.length(), var7.a.length(), this.b.b.getWorksheets(), true);
            var4.append(var7.a);
            if (var7.b == null) {
               var8.getFont().c(var3);
            } else {
               var8.getFont().c(var7.b);
            }

            com.aspose.cells.b.a.a.ze.a(var5, (Object)var8);
         }

         var2.a(com.aspose.cells.b.a.zr.a(var4));
         var2.a(var3);
         var2.b(var5);
      }
   }
}
